import { MailerService } from '@nestjs-modules/mailer';
import { Injectable } from '@nestjs/common';

@Injectable()
export class MailService {
  constructor(private mailerService: MailerService) {
  }

  async notifyYuque(context: any, to = 'gengwenhao97@126.com') {
    await this.mailerService.sendMail({
      to,
      subject: '语雀文档' + (context.title ? `《${context.title}》` : '') + '更新通知',
      template: './notify-yuque', // `.hbs` extension is appended automatically
      context,
    });
  }
}
